package com.monkey.algorithm.chapter1.stack

import org.junit.Test

/**
 * 作者：Monkey
 * 日期：2018/1/27
 */
class StackTest {
    @Test
    fun testResizingArrayStack() {
        val stack = ResizeingArrayStack<String>()
        val str = "Hello 中国!"
        for (s in str) {
            stack.push(s.toString())
        }
        for (s in stack) {
            println(s)
        }
    }

    @Test
    fun testStack() {
        val stack = LinkedStack<String>()
        val str = "Hello 中国!"
        for (s in str) {
            stack.push(s.toString())
        }

        val item = stack.pop()
        println("pop: $item")
        stack.push("哈哈")
        for (s in stack) {
            println(s)
        }
    }
}